import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class HandTest {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testCompareTo() {
		Hand hand1 = new Hand();
		hand1.cards.add(new Card("S", "2"));
		hand1.cards.add(new Card("C", "A"));
		hand1.cards.add(new Card("H", "3"));
		hand1.cards.add(new Card("D", "3"));
		
		Hand hand2 = new Hand();
		hand2.cards.add(new Card("S", "A"));
		hand2.cards.add(new Card("C", "2"));
		hand2.cards.add(new Card("D", "3"));
		hand2.cards.add(new Card("H", "4"));
		
		assertEquals("SA", -1, hand1.compareTo(hand2));
	}
	
	@Test
	public void testCompareTo2() {
		Hand hand1 = new Hand();
		hand1.cards.add(new Card("D", "5"));
		hand1.cards.add(new Card("S", "3"));
		hand1.cards.add(new Card("C", "0"));
		hand1.cards.add(new Card("C", "3"));
		
		Hand hand2 = new Hand();
		hand2.cards.add(new Card("H", "K"));
		hand2.cards.add(new Card("H", "4"));
		hand2.cards.add(new Card("C", "J"));
		hand2.cards.add(new Card("H", "5"));
		
		assertEquals("SA", 1, hand1.compareTo(hand2));
	}
	
	@Test
	public void testCompareTo3() {
		Hand hand1 = new Hand();
		hand1.cards.add(new Card("S", "J"));
		hand1.cards.add(new Card("S", "2"));
		hand1.cards.add(new Card("C", "9"));
		hand1.cards.add(new Card("D", "6"));
		
		Hand hand2 = new Hand();
		hand2.cards.add(new Card("C", "K"));
		hand2.cards.add(new Card("C", "Q"));
		hand2.cards.add(new Card("D", "Q"));
		hand2.cards.add(new Card("C", "8"));
		
		assertEquals("SA", 1, hand1.compareTo(hand2));
	}
	
	@Test
	public void testCompareTo4() {
		Hand hand1 = new Hand();
		hand1.cards.add(new Card("D", "5"));
		hand1.cards.add(new Card("D", "Q"));
		hand1.cards.add(new Card("S", "0"));
		hand1.cards.add(new Card("C", "5"));
		
		Hand hand2 = new Hand();
		hand2.cards.add(new Card("C", "K"));
		hand2.cards.add(new Card("C", "0"));
		hand2.cards.add(new Card("D", "5"));
		hand2.cards.add(new Card("H", "Q"));
		
		assertEquals("SA", 0, hand1.compareTo(hand2));
	}
}
